package com.yeyks.common.appcommon.param;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.hibernate.validator.constraints.Range;

import java.io.Serializable;

/**
 * @author Administrator
 */
@ApiModel(description = "分页参数信息")
public class CommonPageParam implements Serializable{
    private static final long serialVersionUID = 8167417656598906939L;

    @Range(min = 1, max = Integer.MAX_VALUE, message = "分页参数错误")
    @ApiModelProperty("当前页")
    private Integer pageNum = 1;

    @Range(min = 1, max = Integer.MAX_VALUE, message = "分页参数错误")
    @ApiModelProperty("每页大小")
    private Integer pageSize = 10;

    @ApiModelProperty("最后一条数据的ID")
    private Integer lastId;

    public Integer getPageNum() {
        return pageNum;
    }

    public void setPageNum(Integer pageNum) {
        this.pageNum = pageNum;
    }

    public Integer getPageSize() {
        return pageSize;
    }

    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }

    public Integer getLastId() {
        return lastId;
    }

    public void setLastId(Integer lastId) {
        this.lastId = lastId;
    }

    public Boolean check(){
        if(null == this.getPageNum() || this.getPageNum().intValue() < 0 || null == this.getPageSize()
        || this.getPageSize() < 0){
            return false;
        }
        return true;

    }
}
